package StudyCode.summary.mycollection;

import java.util.ArrayList;
import java.util.ListIterator;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class RemoveAnElementWhileTraversingThroughElementsOfArrayListUsingListIterator {
	public static void main(String[] args) {
		ArrayList aList = new ArrayList();
		aList.add("1");
		aList.add("2");
		aList.add("3");
		aList.add("4");
		aList.add("5");

		ListIterator listIterator = aList.listIterator();

		listIterator.next();
		listIterator.next();

		listIterator.remove();

		System.out.println("移除 2 后, ArrayList 元素");
		for (int intIndex = 0; intIndex < aList.size(); intIndex++)
			System.out.println(aList.get(intIndex));
	}
}
